package com.yangfan.thread.thread_wangwenjun04;

/**
 * @description: 自定义 Lock 超时测试
 * @author: yangfan
 * @date: Created in 2020/1/27 0027 17:18
 * @modified By:
 *
 */
public class SynchronizedProblem {

    public static void main(String[] args) throws InterruptedException {

        new Thread() {
            @Override
            public void run() {
                SynchronizedProblem.run();
            }
        }.start();

        Thread.sleep(1000);

        Thread t2 = new Thread() {
            @Override
            public void run() {

                SynchronizedProblem.run();

            }
        };
        t2.start();
        Thread.sleep(2000);
        t2.interrupt();
        System.out.println(t2.isInterrupted());
    }

    private synchronized static void run() {
        System.out.println(Thread.currentThread());
        while (true) {

        }
    }
}
